<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/23
 * Time: 14:54
 */

namespace app\mobilewx\controller;;


use app\Model\UsersModel;
use think\Controller;
//手机端公共
class Common extends Controller
{
    public  $Appid='wx48593a544c9109e9';  //微信Appid
    public  $AppSecret='7135e42c07988a663ce4a745baf5baec';//微信Secret
    /*
  * 初始化操作
  */
    public function _initialize()
    {
        $leader=input('leader');//推荐人
        if ($leader){
            session('leader',$leader);//缓存推荐人
        }
        $ss =new Publics;
//        $ss->upSess(10);//（session）更新
        if (session('?user_wx')){//有缓存
            $a=1;
        }else{//第一次进（无缓存）
            $redirect_uri="http%3A%2F%2Flvyide.cn%2fMobilewx%2fWxlogin%2fwx_user_data";//用户同意后去的页面（http://teashop.obay.vip/Home/wxlogin/wx_user_data）
            $url="https://open.weixin.qq.com/connect/oauth2/authorize?appid={$this->Appid}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
            $this->redirect($url);
        }

    }


    //验证是否绑定手机号和密码
    //是否被冻结/删除
    public function yanz(){

        if (session('user_wx.mobile')==NULL){
            $this->redirect('Login/login');
        }

        return true;
    }
}